PageInfo.register({
    "type": "Obj",
    "info": function () {

        var PageObj = {};

        PageObj.require = {
            "$": "jquery",
            "layui": "layui",
            "api": "/assets/js/components/common/data-api",
            "util": "/assets/js/components/common/common-util"
        };

        PageObj.page = function () {

            var FunUtil = {};
            var HtmUtil = {};
            var Page = {};
            

            HtmUtil.table = function (data) {
                var buf = [];

                for (var i = 0, len = data.length; i < len; i++) {

                    var obj   = data[i];

                    buf.push('<tr>                                                                                                       ');
                    buf.push('    <td>' + obj.positionNumber + '</td>                                                                                          ');
                    buf.push('    <td>' + obj.postionName + '</td>                                                                                          ');
                    buf.push('    <td>' + obj.jobSeekerName + '</td>                                                                                          ');
                    buf.push('    <td>' + obj.jobSeekerTelphone + '</td>                                                                                          ');
                    buf.push('    <td>' + obj.jobSeekerWx + '</td>                                                                                          ');
                    buf.push('    <td>' + FunUtil.memory["1005"][obj.jobSeekerRecordOfFormalSchooling] + '</td>                                                                                          ');
                    buf.push('    <td>' + FunUtil.memory["1012"][obj.resumeDealStatus] + '</td>                                                                                          ');
                    buf.push('    <td>' + obj.resumeName + '</td>                                                                                          ');
                    buf.push('    <td>' + obj.companyName + '</td>                                                                                          ');
                    
                    buf.push('    <td>                                                                                                   ');
                    buf.push('        <button class="layui-btn layui-btn-small admin-handle-btn-edit " data-id="'+obj.id+'" data-resumeDealStatus="'+obj.resumeDealStatus+'">反馈</button>                       ');
                    buf.push('        <button class="layui-btn layui-btn-danger layui-btn-small admin-handle-btn-forbid" data-resumeType="'+obj.resumeType+'" data-id="'+obj.id+'"  data-isValid="'+((String.HasText(obj.isValid) && obj.isValid == 1 ) ? "2" : "1") +'">查看简历</button>    ');
                    buf.push('    </td>                                                                                                  ');
                    buf.push('</tr>                                                                                                      ');
                }
                ;
                return buf.join("");


            };
            HtmUtil.add = function (data) {
                var buf = [];
                buf.push('<div id="admin-handle-add">                                                                                                              ');
                buf.push('    <form class="layui-form" action="">                                                                                                 ');
                buf.push('        <div class="layui-form-item">                                                                                                   ');
                buf.push('            <label class="layui-form-label">姓名</label>                                                                                ');
                buf.push('            <div class="layui-input-block">                                                                                             ');
                buf.push('                <input type="text" name="userName" lay-verify="required" autocomplete="off" placeholder="" class="layui-input">     ');
                buf.push('            </div>                                                                                                                      ');
                buf.push('        </div>                                                                                                                          ');
                buf.push('        <div class="layui-form-item">                                                                                                   ');
                buf.push('            <label class="layui-form-label">账号</label>                                                                                ');
                buf.push('            <div class="layui-input-block">                                                                                             ');
                buf.push('                <input type="text" name="userTelephone" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">   ');
                buf.push('            </div>                                                                                                                      ');
                buf.push('        </div>                                                                                                                          ');
                buf.push('                                                                                                                                        ');
                buf.push('        <div class="layui-form-item">                                                                                                   ');
                buf.push('            <label class="layui-form-label">性别</label>                                                                                ');
                buf.push('            <div class="layui-input-block">                                                                                             ');
                buf.push('                 <input type="radio" name="userSex" value="1" title="男" checked="">                                                       ');
                buf.push('                 <input type="radio" name="userSex" value="2" title="女">                                                                  ');
                buf.push('            </div>                                                                                                                      ');
                buf.push('        </div>                                                                                                                          ');
                buf.push('                                                                                                                                        ');
                buf.push('        <div class="layui-form-item">                                                                                                   ');
                buf.push('            <label class="layui-form-label">电话</label>                                                                                ');
                buf.push('            <div class="layui-input-block">                                                                                             ');
                buf.push('                <input type="text" name="userTelephone" lay-verify="required|phone|number" placeholder="请输入" autocomplete="off" class="layui-input">   ');
                buf.push('            </div>                                                                                                                      ');
                buf.push('        </div>                                                                                                                          ');
                buf.push('                                                                                                                                        ');
                buf.push('        <div class="layui-form-item">                                                                                                   ');
                buf.push('            <label class="layui-form-label">邮箱</label>                                                                                ');
                buf.push('            <div class="layui-input-block">                                                                                             ');
                buf.push('                <input type="text" name="userEmail" lay-verify="required|email" placeholder="请输入" autocomplete="off" class="layui-input">   ');
                buf.push('            </div>                                                                                                                      ');
                buf.push('        </div>                                                                                                                          ');
                buf.push('                                                                                                                                        ');
                buf.push('        <div class="layui-form-item">                                                                                                   ');
                buf.push('            <div class="layui-input-block">                                                                                             ');
                buf.push('                <button class="layui-btn" lay-submit="" lay-filter="admin-handle-add-btn">确定</button>                                            ');
                buf.push('            </div>                                                                                                                      ');
                buf.push('        </div>                                                                                                                          ');
                buf.push('    </form>                                                                                                                             ');
                buf.push('</div>                                                                                                                                  ');
                return buf.join("");
            };
            HtmUtil.update = function (data) {

                var obj = data;
                var buf = [];
                buf.push('<div id="admin-handle-add"> ');
                buf.push('    <form class="layui-form" action="">');
                buf.push('        <div class="layui-form-item" style="margin-top: 58px;"> ');
                buf.push('            <label class="layui-form-label">投递状态</label>     ');
                buf.push('            <div class="layui-input-block" style="    width: 254px;">                                                                                             ');
                buf.push('                  <select name="operateStatus" id="common-select-1012"  > ');
                obj.resumeDealStatus = parseFloat(obj.resumeDealStatus);
                
                var sbuf = [];
                
                for(var p in FunUtil.memory["1012"]){
                	var sobj = FunUtil.memory["1012"][p];
                	if(p == "unique") break;
                	
                	  var isselect = ((obj.resumeDealStatus >= p) ? "selected":"");
                	  if(p == "-1"){
                	  	sbuf.unshift(' <option value="'+p+'"  disabled="">'+sobj+'</option>');
                	  }
				      if(isselect){
				      	sbuf.push(' <option value="'+p+'"  disabled="">'+sobj+'</option>');
				      }else{
				      	sbuf.push(' <option value="'+p+'" >'+sobj+'</option>');
				      }
                }
                sbuf.length = sbuf.length-1;
                
                buf = buf.concat(sbuf);
                
                buf.push('</select>                                                                  ');
                buf.push('            </div>                                                                                                                      ');
                buf.push('        </div>                                                                                                                          ');
                buf.push('                                                                                                                                        ');
                buf.push('        <div class="layui-form-item" >                                                                                                   ');
                buf.push('            <label class="layui-form-label">原因</label>                                                                                ');
                buf.push('            <div class="layui-input-block" style="    width: 254px;">                                                                                             ');
                buf.push('                <textarea placeholder="请输入内容" name="rejectReason" class="layui-textarea"></textarea>     ');
                buf.push('            </div>                                                                                                                      ');
                buf.push('        </div>                                                                                                                          ');
               

                buf.push('        <div class="layui-form-item" style="display:none">                                                                                                   ');
                buf.push('            <label class="layui-form-label">id</label>                                                                                ');
                buf.push('            <div class="layui-input-block">                                                                                             ');
                buf.push('                <input type="text" name="deliveryId" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" value="'+obj.id+'">   ');
                buf.push('            </div>                                                                                                                      ');
                buf.push('        </div>                                                                                                                          ');



                buf.push('                                                                                                                                        ');
                buf.push('        <div class="layui-form-item">                                                                                                   ');
                buf.push('            <div class="layui-input-block">                                                                                             ');
                buf.push('                <button class="layui-btn" lay-submit="" lay-filter="admin-handle-update-btn">确定</button>                                            ');
                buf.push('            </div>                                                                                                                      ');
                buf.push('        </div>                                                                                                                          ');
                buf.push('    </form>                                                                                                                             ');
                buf.push('</div>                                                                                                                                  ');
                return buf.join("");
            };
            
            HtmUtil.resume = function(cdata){
            	var buf = [];
            	
            	
            	buf.push('<div><img src="data:,'+cdata.data.base64Content+'"/></div>');
            	
            	
            	
            	
            	return buf.join("");
            };
            HtmUtil.search = function(){
            	var buf = [];
            	
            	buf.push('<div class="common-model">                                                                                                               ');
buf.push('    <form class="layui-form  " action="">                                                                                                ');
buf.push('        <div class="layui-form-item">                                                                                                    ');
buf.push('            <div class="layui-inline">                                                                                                   ');
buf.push('                <label class="layui-form-label">公司名称</label>                                                                         ');
buf.push('                <div class="layui-input-inline">                                                                                         ');
buf.push('                    <input type="text" name="companyName" autocomplete="off" class="layui-input">                                        ');
buf.push('                </div>                                                                                                                   ');
buf.push('            </div>                                                                                                                       ');
buf.push('            <div class="layui-inline">                                                                                                   ');
buf.push('                <label class="layui-form-label">职位编号</label>                                                                         ');
buf.push('                <div class="layui-input-inline">                                                                                         ');
buf.push('                    <input type="text" name="positionNumber" class="layui-input">                                                        ');
buf.push('                </div>                                                                                                                   ');
buf.push('            </div>                                                                                                                       ');
buf.push('            <div class="layui-inline">                                                                                                   ');
buf.push('                <label class="layui-form-label">职位名字</label>                                                                         ');
buf.push('                <div class="layui-input-inline">                                                                                         ');
buf.push('                    <input type="tel" name="postionName" class="layui-input">                                                            ');
buf.push('                </div>                                                                                                                   ');
buf.push('            </div>                                                                                                                       ');
buf.push('        </div>                                                                                                                           ');
buf.push('                                                                                                                                         ');
buf.push('        <div class="layui-form-item">                                                                                                    ');
buf.push('            <div class="layui-inline">                                                                                                   ');
buf.push('                <label class="layui-form-label">求职者姓名</label>                                                                       ');
buf.push('                <div class="layui-input-inline">                                                                                         ');
buf.push('                    <input type="text" name="jobSeekerName" autocomplete="off" class="layui-input">                                      ');
buf.push('                </div>                                                                                                                   ');
buf.push('            </div>                                                                                                                       ');
buf.push('            <div class="layui-inline">                                                                                                   ');
buf.push('                <label class="layui-form-label">求职者电话</label>                                                                         ');
buf.push('                <div class="layui-input-inline">                                                                                         ');
buf.push('                    <input type="text" name="jobSeekerPhone" class="layui-input">                                                        ');
buf.push('                </div>                                                                                                                   ');
buf.push('            </div>                                                                                                                       ');
buf.push('            <div class="layui-inline">                                                                                                   ');
buf.push('                <label class="layui-form-label">求职者微信ID</label>                                                                         ');
buf.push('                <div class="layui-input-inline">                                                                                         ');
buf.push('                    <input type="tel" name="jobSeekerWx" class="layui-input">                                                            ');
buf.push('                </div>                                                                                                                   ');
buf.push('            </div>                                                                                                                       ');
buf.push('        </div>                                                                                                                           ');
buf.push('                                                                                                                                         ');
buf.push('        <div class="layui-form-item">                                                                                                    ');
buf.push('            <div class="layui-inline" style="display:none">                                                                                                   ');
buf.push('                <label class="layui-form-label">求职者学历</label>                                                                       ');
buf.push('                <div class="layui-input-inline">                                                                                         ');
buf.push('                    <select name="jobSeekerRecordOfFormalSchooling" id="admin-handle-form-jobSeekerRecordOfFormalSchooling"><option></option>   </select>         ');
buf.push('                </div>                                                                                                                   ');
buf.push('            </div>                                                                                                                       ');
buf.push('            <div class="layui-inline">                                                                                                   ');
buf.push('                <label class="layui-form-label">简历处理状态</label>                                                                     ');
buf.push('                <div class="layui-input-inline">                                                                                         ');
buf.push('                    <select name="resumeDealStatus" id="admin-handle-form-resumeDealStatus">                                             ');
buf.push('                        <option></option>                                                                                                ');
buf.push('                    </select>                                                                                                            ');
buf.push('                                                                                                                                         ');
buf.push('                </div>                                                                                                                   ');
buf.push('            </div>                                                                                                                       ');
buf.push('            <div class="layui-inline">                                                                                                   ');
buf.push('                <div class="layui-input-block">                                                                                          ');
buf.push('                    <button class="layui-btn" lay-submit="" id="admin-handle-query-btn" lay-filter="admin-handle-query-btn">搜索</button>');
buf.push('                </div>                                                                                                                   ');
buf.push('            </div>                                                                                                                       ');
buf.push('                                                                                                                                         ');
buf.push('        </div>                                                                                                                           ');
buf.push('                                                                                                                                         ');
buf.push('    </form>                                                                                                                              ');
buf.push('</div>                                                                                                                                   ');

return buf.join("")
            };
            
            
            FunUtil.common4openUrl   = function(data){
 	        	var url = data.url;
 	        	
 	        	if(!String.HasText(url))  return;
  	        	
 	        	var id4url = "until-open-url";
 	        	var $url   = $("#"+id4url);
 	        		
 	        	if( $url.length <= 0)  $("body").append('<a style="color: #f6f6f6;"><span id="'+id4url+'" >a</span></a>');
 	        		
 	        	$url  = $("#"+id4url);
 	        	var $this = $url.closest("a");
 	        	
 	        	$this.attr("href",url).attr("target","_blank");
 	        	//$url.click();
 	        	document.getElementById(id4url).click(); 
 	        	setTimeout(function(){ $this.remove(); },200);
 	        };
	
            
            Page.show = function () {

                var request = this.api;
                var util = this.util;
				util.filter();

                var $query = $("#admin-handle-query-btn");

                var Help = {

                    data: {
                        tableData:[],
                        activityRow:{},
                        totalPage:0,
                        isStart:false,
                        form:{
                            "pageNo": 1,
                            "pageSize": 5,
                        }
                    },

                    fun4start: function () {
                        var $this = this;
                         
                         	 
                         	    request.ntqProvider.getDictTypeCode({"dictTypeCode":"1012,1005"}, function (cdata) {
						        	var execuFun = function(list,key){
                                        var result = [];
                                        for(var i =0,len= list.length;i<len;i++){
                                        	var obj = list[i];
                                        
                                        	if(obj.dictTypeCode == key) result[obj.dictdataCode] = obj.dictdataName; 
                                        }
                                        
                                        return result;
                                     };   
                                    
                                     FunUtil.memory = {"1012":execuFun(cdata.data,"1012"),"1005":execuFun(cdata.data,"1005"),data:cdata };
                                     $("#admin-handle-form").html(HtmUtil.search());
                                     document.getElementById("admin-handle-form-resumeDealStatus").innerHTML =  util.selectBuffer({"list":FunUtil.memory.data.data,"key":"1012"});
                                     document.getElementById("admin-handle-form-jobSeekerRecordOfFormalSchooling").innerHTML =  util.selectBuffer({"list":FunUtil.memory.data.data,"key":"1005"});
                                     
                                     util.layout(function(cparam){
                                     	$this.data.layparam = cparam;
                                         cparam.form.on('submit(admin-handle-query-btn)', function (data) {
                                         	$this.data.form = Object.assign($this.data.form, data.field)
                                         	$this.data.form.pageNo = 1;
                                            request.resumeDeal.query($this.data.form, function (cdata) {
                                        
                                                $this.data.totalPage = cdata.totalPage;
                                               if($this.data.form.pageNo == 1) $this.fun4page(cdata);
                                        
                                            })
                                            return false;
                                        });
                                        
                                        setTimeout(function(){
                                        	$("#admin-handle-query-btn").click();
                                        },1000);
                                    });
                                });   
                         	

                    },

                    fun4search: function () {
                        var $this = this;
						
						console.log("===============");
						var cparam = $this.data.layparam; 

                        cparam.form.on('submit(admin-handle-query-btn)', function (data) {
                        	var pparam = Object.assign($this.data.form, data.field);
                        	delete pparam.jobSeekerRecordOfFormalSchooling;
                            request.resumeDeal.query(pparam, function (cdata) {

                                $this.data.totalPage = cdata.totalPage;
                               if($this.data.form.pageNo == 1) $this.fun4page(cdata);

                            })
                            return false;
                        });
							
							 
						
						
                    },
                    fun4page:function(data){
                        var $this = this;
                        util.layout(function(cparam){
                            if($this.data.form.pageNo > 1) return; 
                            cparam.laypage({cont: 'admin-handle-body-page' ,curr:$this.data.form.pageNo, pages: $this.data.totalPage , skip: true,jump: function (obj, first) {
                                $this.data.form.pageNo = obj.curr;
                                if(String.HasText(data)){ $this.fun4table(data);data = ""; return;}

                                request.resumeDeal.query($this.data.form, function (cdata) {
                                     $this.fun4table(cdata);
                                });
                            }});
                        });


                    },

                    fun4table: function (cdata) {
                        var $table = $("#admin-handle-table");
                        var $this = this;

                        $table.html("");
                        $table.html(HtmUtil.table(cdata.results));
                        console.log(cdata);

                        $("button.admin-handle-btn-edit").unbind("click").bind("click", function () {
							
                            var $self = this;
                            var id    = $self.getAttribute("data-id");
                            
                            var resumeDealStatus=  $self.getAttribute("data-resumeDealStatus");
							 
							if($self.getAttribute("class").indexOf("layui-btn-disabled") > 0) return;

                              layer.open({  type: 1,   content: HtmUtil.update({"id":id,"resumeDealStatus":resumeDealStatus}),  area: ['480px', '378px'], skin: 'layui-layer-demo',  success: function (layero, index) {
                                    util.layout(function(cparam){

                                        cparam.form.on('submit(admin-handle-update-btn)', function (data) {
                                            console.log(data);
                                            request.resumeDeal.post(data.field, function (cdata) {
                                            	 layer.close(index);
                                                     console.log(cdata);
                                                request.resumeDeal.query($this.data.form, function (cdata) {
                                                     $this.fun4table(cdata);
                                                    
                                                });
                                                
                                            });
                                            return false;
                                        });
                                    });
                                }
                              });

                        });
 
                        
                        $("button.admin-handle-btn-del").unbind("click").bind("click", function () {
                            var $self = this;
                            var id = $self.getAttribute("data-id");
							if($self.getAttribute("class").indexOf("layui-btn-disabled") > 0) return;
							
							layer.confirm('确定操作？', {btn: ['确定','取消'] }, function(){
								
								request.ntqSysUser.delete({"id":id}, function (cdata) {
							    	$query.click();
									layer.closeAll();
                                });

							}, function(){ });
 
                        });
						
						$("button.admin-handle-btn-update").unbind("click").bind("click", function () {
                            var $self = this;
                            var id = $self.getAttribute("data-id");
							if($self.getAttribute("class").indexOf("layui-btn-disabled") > 0) return;
							
							
								
							layer.confirm('确定操作？', {btn: ['确定','取消'] }, function(){
								
								request.ntqSysUser.reset({"id":id}, function (cdata) {
							    	$query.click();
									layer.closeAll();
                                });

							}, function(){ });
 
                        });


                        $("button.admin-handle-btn-forbid").unbind("click").bind("click", function () {
                            var $self = this;
                            var id = $self.getAttribute("data-id");
                            var  resumeType = $self.getAttribute("data-resumeType");
                            
                            var isValid = $self.getAttribute("data-isValid");
							if($self.getAttribute("class").indexOf("layui-btn-disabled") > 0) return;
						 
							request.resumeDeal.get({"deliveryId":id,"resumeType":resumeType},function(cdata){
							 
								FunUtil.common4openUrl({"url":location.origin+"/"+cdata.data})
								
							 /*layer.open({  type: 1,   content:HtmUtil.resume(cdata) ,  area: ['480px', '378px'], skin: 'layui-layer-demo',  success: function (layero, index) {
                                
                              }});*/
							});
							
						    
							 
                        });

                    },


                };
                Help.fun4start();


            };

            return Page;

        };

        return PageObj;
    }
});